package com.jml; 
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;

/**
 * jwt进行解密
 */
public class JWTDemo02 {
    private static final String signKey = "jmlKey";
    public static void main(String[] args) {
        String jwt = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2NiIsInN1YiI6ImptbCIsImlhdCI6MTY0ODUzNDk1MSwidXNlck5hbWUiOiJqbWx1c2VyTmFtZSJ9.ETyt6niFPxNRHUNWc-IDMy5UCIOGdqP9SRY4G8wwS-A";
        Claims body = Jwts.parser().setSigningKey(signKey).parseClaimsJws(jwt).getBody();
        System.out.println(body.get("userName"));
        System.out.println(body.getSubject());
        System.out.println(body.getId());
        System.out.println(body.getIssuedAt());
        System.out.println(body.getExpiration());
    }
}
